range: start autoscrolling near the edges of ranges
authorWilliam Jon McCann <william.jon.mccann@gmail.com>
Mon, 7 Oct 2013 16:01:13 +0000 (12:01 -0400)
committerWilliam Jon McCann <william.jon.mccann@gmail.com>
Mon, 7 Oct 2013 20:38:49 +0000 (16:38 -0400)
If a range goes all the way to the edge of the screen then we don't
have any way to activate autoscrolling. By adding a small region
at the ends of the range we can handle this case. This is the same
approach used in treeviews.

gtk/gtkrange.c

index aff4ff3eaab28b2b3b776981648123de8a899fd6..092dd4beef0b147fa5bd6055df934b9db65e6e42 100644 (file)
@@ -65,6 +65,7 @@
 #define TIMEOUT_REPEAT      50
 #define ZOOM_HOLD_TIME      500
 #define AUTOSCROLL_FACTOR   20
+#define SCROLL_EDGE_SIZE 15
 
 typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
 
@@ -3052,9 +3053,9 @@ update_autoscroll_mode (GtkRange *range)
           pos = range->priv->mouse_x;
         }
 
-      if (pos < 0)
+      if (pos < SCROLL_EDGE_SIZE)
         mode = GTK_SCROLL_STEP_BACKWARD;
-      else if (pos > size)
+      else if (pos > (size - SCROLL_EDGE_SIZE))
         mode = GTK_SCROLL_STEP_FORWARD;
     }